package com.demo1216.dao.impl;

import com.demo1216.dao.AccountDao;
import com.demo1216.dao.BaseDao;
import com.demo1216.entity.Account;

import java.sql.Connection;

public class AccountDaoImpl extends BaseDao implements AccountDao {
    @Override
    public int update(Connection connection, Account account) {
        String sql = "UPDATE `t_account` SET `money` = ? WHERE `name` = ?";
        return super.update(connection, sql, account.getMoney(), account.getName());
    }

    @Override
    public Account queryByName(String name) {
        String sql = "SELECT * FROM `t_account` WHERE `name` = ?";
        return super.queryOne(Account.class, sql, name);
    }
}
